package com.blb.edugatewayservice.filter;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.SetOperations;

import java.util.List;
import java.util.Set;

/**
 * 读取白名单配置
 */
//@ConfigurationProperties(prefix = "user-login-gateway")
@Configuration
public class WhiteListConfig {

    @Autowired
    private RedisTemplate<String,String> redisTemplate;

    /**
     * 读取white-list集合
     */
    public Set<String> getWhiteList() {
        //读取redis中的set集合
        SetOperations<String, String> whiteSet = redisTemplate.opsForSet();
        Set<String> set = whiteSet.members("white-list");
        return set;
    }
}
